package com.chenchao.method;

/**
 * @encoding : UTF-8
 * @Time : 2020/12/4 14:12
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.method.Test01.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * 函数式接口作为方法参数
 */
public class Test01 {
    public static void main(String[] args) {
        startWalk(new Walkable() {
            @Override
            public void walk() {
                System.out.println("我会走路");
            }
        });
        startWalk(()-> System.out.println("我也会走路"));
    }
    public static void startWalk(Walkable walkable){
        walkable.walk();
    }
}
@FunctionalInterface
interface Walkable {
    /**
     * 步行
     */
    void walk();
}
